package com.smart4j.framework.aop.spring.five;

import java.lang.reflect.Method;

import org.springframework.aop.ThrowsAdvice;
import org.springframework.stereotype.Component;

/**
 * description: SpringAOP ThrowsAdvice 抛出增强。拦截异常信息。 作用类似于 MethodInterceptor 。
 * @version v1.0
 * @author w
 * @date 2018年9月23日下午8:44:37
 * @see ThrowsAdvice 接口中并没有任何方法，查看注释line29~line32 .
 * 		public void afterThrowing(Exception ex)   <br>
 *		public void afterThrowing(RemoteException)  <br>
 *		public void afterThrowing(Method method, Object[] args, Object target, Exception ex) <br>
 *		public void afterThrowing(Method method, Object[] args, Object target, ServletException ex) <br>
 * 
 * @see  https://blog.csdn.net/qq_26525215/article/details/52420658
 */
@Component
public class GreetingThrowsAdvice implements ThrowsAdvice {
	
	public void afterThrowing(Method method, Object[] args, Object target, Exception ex){
		System.out.println(" exception before ...");
		System.out.println("Target Class : "+target.getClass().getName());
		System.out.println("Target Method : "+method.getName());
		System.out.println("message info : "+ ex.getMessage());
		System.out.println(" exception after ... over .");
	}
}
